/*
 * dacPacketHandler.h
 *
 * Created: 6/13/2013 3:01:33 AM
 *  Author: Tim
 */ 


#ifndef DACPACKETHANDLER_H_
#define DACPACKETHANDLER_H_

#include <inttypes.h>


#include "../../packets/status.h"
#include "../../communication/comPort.h"
#include "../../packets/structs/msgHeaderDefs.h"
#include "../../packets/structs/dacPacketStructs.h"
#include "../../packets/CRC.h"
#include "../../features/dac/dac.h"
#include "genPacketHandler.h"
static status_t dacEnableHandler(dacEnable_t *packet)
{
	
	if(packet->PARAM1.DCHM & DAC_CH0_bp) 
	{
		if(daqAlloc.analogAlloc.analogOutCh0Alloc == FEATURE_FREE)
		{
			outputSuperPacketLength +=2;
		}
		daqAlloc.analogAlloc.analogOutCh0Alloc = FEATURE_UTILIZED;
		sendGenAck(dacEnable_mh,DAC_CH0_bp);
	}
	
	if(packet->PARAM1.DCHM & DAC_CH1_bp)
	{
		if(daqAlloc.analogAlloc.analogOutCh1Alloc == FEATURE_FREE)
		{
			outputSuperPacketLength +=2;
		}
	
		daqAlloc.analogAlloc.analogOutCh1Alloc = FEATURE_UTILIZED;
		sendGenAck(dacEnable_mh,DAC_CH1_bp);
	}
	
	
	return OPP_SUCCESSFUL;

}

#endif /* DACPACKETHANDLER_H_ */